<template>
    <view>
        <view class="uni-common-mt">
            <view class="uni-form-item uni-column">
                <view class="title">用户名</view>
                <input class="uni-input" focus placeholder="请输入用户名" />
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">密码</view>
                <input class="uni-input" v-model='passw1' password placeholder="请输入密码" />
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">确认密码 {{pwdEnableInfo}}</view>
                <input class="uni-input" @input="pwdEnable" v-model='passw2' password placeholder="请确认密码"/>
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">验证码<image class='verify_code' :src="verifyCode" @click="reflashVerify"/></view>
                <input class="uni-input" placeholder="请输入验证码"/>
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">昵称</view>
                <input class="uni-input" type="text" placeholder="请输入昵称" />
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">生日</view>
                <view class="uni-list">
                    <view class="uni-list-cell">
                        <view class="uni-list-cell-left">
                        当前选择
                        </view>
                        <view class="uni-list-cell-db">
                            <picker mode="date" :value="date" @change="bindDateChange">
                                <view class="uni-input">{{date}}</view>
                            </picker>
                        </view>
                    </view>
                </view>
            </view>
            <view class="uni-form-item uni-column">
                <view class="title">地点</view>
					<input class="uni-input" type="text" placeholder-style="color:#F76260" placeholder="请输入电话(必填)" />
				</view>
            <view class="uni-form-item uni-column">
                <view class="title">电话</view>
                <input class="uni-input"  type="number" placeholder-style="color:#F76260" placeholder="请输入电话(必填)" />
            </view>
        </view>
    </view>
</template>

<script>
	export default {
	    data() {
	        return {
	            title: 'input',
	            focus: false,
	            inputValue: '',
	            changeValue: '',
				pwdEnableInfo: '',

				passw1: '',
				passw2: '',
				
				verifyCode: '../../static/ve.png',
				
				date: '',
	        }
	    },
	    methods: {
			
			bindDateChange: function(e) {
				console.log(e)
				this.date = e.detail.value
			},
			
			pwdEnable: function(e) {
				if(this.passw1 === this.passw2) {
					this.pwdEnableInfo = '√';
				} else {
					this.pwdEnableInfo = '密码不一致';
				}
			},
			reflashVerify: function(e) {
				this.verifyCode = this.verifyCode.split('?')[0] + '?msg='+Math.random(10);
			},
	        onKeyInput: function(event) {
	            this.inputValue = event.target.value
	        },
	        replaceInput: function(event) {
	            var value = event.target.value;
	            if (value === '11') {
	                this.changeValue = '2';
	            }
	        },
	        hideKeyboard: function(event) {
	            if (event.target.value === '1234') {
	                uni.hideKeyboard();
	            }
	        }
	    }
	}
</script>

<style>
	.verify_code {
		height: 40px;
		width: 100px;
	}
</style>
